package com.lz.util.excel;

/**
 * Export..
 *
 * https://github.com/alibaba/easyexcel
 *
 * @author Lizhong
 * @date 2019/3/5
 */
public class Export {
      /*
       // 有web传入的HttpServletResponse
      response.setContentType("multipart/form-data");
        response.setCharacterEncoding("utf-8");
    String fileName = fileName = new String(("UserInfo" + new SimpleDateFormat("yyyy-MM-dd").format(new Date()))
            .getBytes(), "UTF-8");
        response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx");

    ServletOutputStream out = response.getOutputStream();
    ExcelWriter writer = new ExcelWriter(out, ExcelTypeEnum.XLSX, true);
    // ExcelModel.class
    Sheet sheet1 = new Sheet(1, 0,ExcelModel.class);
        sheet1.setSheetName("第一个sheet");

    // 设置样式,
        sheet1.setAutoWidth(true);
    TableStyle tableStyle = new TableStyle();
        tableStyle.setTableContentBackGroundColor(IndexedColors.RED);
    Font tableContentFont = new Font();
        tableContentFont.setBold(true);
    // 字号大小
        tableContentFont.setFontHeightInPoints(Short.parseShort("1"));
        tableContentFont.setFontName("仿宋");
        tableStyle.setTableContentFont(tableContentFont);

        tableStyle.setTableHeadBackGroundColor(IndexedColors.BLUE1);
        sheet1.setTableStyle(tableStyle);
    ExcelModel excelModel = new ExcelModel();
        excelModel.setName("张三");
        excelModel.setAddress("四川省成都市广汉去");
    ExcelModel excelModel0 = new ExcelModel();
        excelModel0.setName("李四");
        excelModel0.setAddress("四川省成都市武侯区");
    List<ExcelModel> excelModels = Arrays.asList(excelModel, excelModel0);
        writer.write(excelModels,sheet1);
    // writer.write0(Arrays.asList(Arrays.asList("number1", "number2", "number3"), Arrays.asList("str1", "str2", "str3")), sheet1);
        writer.finish();
        out.flush();

        */

}
